<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">导出月报</h4>
</div>
<form id="export-form" action="/xqc/sales-report/payment-detail-jp-ajax" method="post">
    <div class="modal-body">
        <div class="row">
            <div class="form-group" style="padding-top: 30px;">
                <label style="padding-top: 3px;text-align: right;" class="col-sm-3 control-label">报表类型</label>
                <div class="col-sm-8">
                    <select id="type_e" name="param[type]">
                        {{ getOptions(\App\Models\SalesReport\PaymentDetailJP::$_type,1) }}
                    </select>
                </div>
            </div>
            <div class="form-group" style="padding-top: 30px;">
                <label style="padding-top: 3px;text-align: right;" class="col-sm-3 control-label">开始日期</label>
                <div class="col-sm-8">
                    <input type="text" id="start_date" name="param[start_date]" placeholder="开始日期">
                </div>
            </div>
            <div class="form-group" style="padding-top: 30px;">
                <label style="padding-top: 3px;text-align: right;" class="col-sm-3 control-label">截止日期</label>
                <div class="col-sm-8">
                    <input type="text" id="end_date" name="param[end_date]" placeholder="截止日期">
                </div>
            </div>
        </div>
        <div style="margin-bottom: 10px;color: red">
            报表核算命令：<a href="javascript:void(0);" title="点击复制" onclick="copyCmd(this)">php artisan payment:report-for-jp</a>{date=null}
        </div>
        <textarea id="copyText" style="display:none;"></textarea>
    </div>
    <div class="modal-footer">
        {{ csrf_field() }}
        <input type="hidden" name="action" value="doPaymentDetailForJPExport">
        <button type="submit" class="btn btn-primary" id="export-submit">提交</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
    </div>
</form>

<script language="JavaScript" type="text/javascript">
    function copyCmd(obj) {
        if (!obj.innerText) {
            swal('文本异常', '', 'error');
            return false;
        }
        //内容
        $('#copyText').text(obj.innerText).show();
        document.getElementById("copyText").select();
        //剪切板
        document.execCommand('copy', false, null);
        $('#copyText').hide();
        toastr.success('命令复制成功');
    }

    $(function () {
        $('#type_e').select2({placeholder: '报表类型', allowClear: true, width: '157px'});
        $('#start_date').datetimepicker({
            "format":"YYYY-MM-01",
            "locale":"zh-CN",
            "allowInputToggle":true
        });
        $('#end_date').datetimepicker({
            "format":"YYYY-MM-01",
            "locale":"zh-CN",
            "maxDate":moment(),
            "allowInputToggle":true
        });

        $('#export-submit').unbind('click').click(function(e) {
            $("#checkModal").modal('hide');
            $(".modal-backdrop").remove();
            $('body').removeClass('modal-open');
        });
    });
</script>
